package br.com.lh.urabuilder.event.factory
{
	import br.com.lh.urabuilder.event.AddActionEvent;
	import br.com.lh.urabuilder.event.LoadUraEvent;
	import br.com.lh.urabuilder.event.LoadUraResourceEvent;
	import br.com.lh.urabuilder.event.RemoveActionEvent;
	import br.com.lh.urabuilder.event.SavePropertiesEvent;
	import br.com.lh.urabuilder.view.ActionComponent;
	
	import com.adobe.cairngorm.control.CairngormEvent;

	public class UraEventFactoryImpl implements UraEventFactory
	{
		public function UraEventFactoryImpl()
		{
		}

		public function getEventWithActionComponent(eventName:String, actionComponent:ActionComponent):CairngormEvent{
			if (eventName == AddActionEvent.EVENT_ADD_ACTION){
				return new AddActionEvent(actionComponent);
			}else if (eventName == RemoveActionEvent.EVENT_REMOVE_ACTION){
				return new RemoveActionEvent(actionComponent);
			}else if (eventName == SavePropertiesEvent.EVENT_SAVE_PROPERTIES_ACTION){
				return new SavePropertiesEvent(actionComponent);
			}else{
				return null;
			}
		}
		
		public function getLoadUraEvent(eventName:String,sessionId:String,uraId:String="-1"):CairngormEvent{
			if (eventName == LoadUraEvent.EVENT_LOAD_URA_ACTION){
				return new LoadUraEvent(uraId,sessionId);
			}else if (eventName == LoadUraResourceEvent.EVENT_LOAD_URA_RESOURCE_ACTION){
				return new LoadUraResourceEvent(sessionId);
			}else{
				return null;
			}
		}
		
	}
}